<!DOCTYPE html>
<html>
<head>
<title> Event.defaultPrevented is reset after dipatchEvent() </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
   
<input id="target" type="hidden" value=""/>
        
<script>
    var EVENT = "foo";
    var TARGET = document.getElementById("target");
    var PreState;
    var PosState;
    
    var description = "Test Description: " + 
                      "As the final step of the event dispatch, the implementation must reset the event " +
                      "object's default-action-prevention state. ";

    test(function()
    {         
        var evt = document.createEvent("Event");
        evt.initEvent(EVENT, true, true);
        
        TARGET.addEventListener(EVENT, TestEvent, true);
        TARGET.dispatchEvent(evt);
        
        PosState = evt.defaultPrevented;

        assert_array_equals([evt.target, PreState, PosState], [TARGET, true, false]);

    }, description);
    
    function TestEvent(evt) 
    {
        evt.preventDefault();
        PreState = evt.defaultPrevented;
    }
</script>
</body>
</html>
